import { createList } from './api'
import List from './List'
import { memo } from 'react'

const SearchResults = ({ query }) => {
    const list = createList(query);
  return <List 
            list={list} 
            renderItem={(item) => (
                <Item key={item} text={item} />
            )}
            />
};

export default memo(SearchResults);

function Item(props) {
    let startTime = performance.now();
    while (performance.now() - startTime < 1) {}
  
    return (
      <div>{props.text}</div>
    )
}